<?php
    class dal {
        private $servidor;
        private $usuario;
        private $password;
        private $basedatos;
        
        public function dal(){
            $this->servidor = "localhost";
            $this->usuario = "root";
            $this->password = "root";
            $this->basedatos = "bdchounglee";
        }
        public function conectar(){
            $mysqli = new mysqli($this->servidor,$this->usuario,$this->password,$this->basedatos);
            if(mysqli_connect_errno()){
                echo "Connection Failed: ".mysqli_connect_errno();
                exit();
            }
            return $mysqli;
        }
        public function ejecutar($sql){
            $db = $this->conectar();
            return $db->query($sql);
        }
    }
?>
